package query.ddl

import ast.statement.ddl.SqlDropTable
import ast.expr.SqlIdentifierExpr
import expr.DB
import query.ReviseQuery
import util.toSqlString
import java.sql.Connection

class DropTable(
    var db: DB = DB.MYSQL,
    override var conn: Connection? = null,
    override var isTransaction: Boolean = false
) : ReviseQuery() {
    constructor(db: DB) : this(db, null, false)

    private var sqlDropTable = SqlDropTable()

    infix fun drop(table: String): DropTable {
        sqlDropTable.table = SqlIdentifierExpr(table)
        return this
    }

    override fun sql() = toSqlString(sqlDropTable, db)
}